import http from "@/api";
import { Delivery, AccCar, transfer, PhoneTime, StationAdmin } from "@/api/interface/city/organizationManage";

// 获取配送员账号状态列表
export const getNewRegisterAPI = (data: Delivery.NewParams) => {
  return http.post<Delivery.NewRow[]>("/manager/deliveryman", data, { loading: false });
};
// 添加配送员
export const addDeliveryAPI = (data: Delivery.AddParams) => {
  return http.post("/manager/deliveryman/add", data, { loading: false });
};
// 获取详情
export const getDeliveryDetailAPI = (userId: number) => {
  return http.get<Delivery.DetailData>(`/manager/deliveryman/${userId}`, { loading: false });
};
// 审核账号
export const examineAPI = (data: Delivery.ExamineParams) => {
  return http.post(`/manager/deliveryman/audit`, data, { loading: false });
};
// 查询未退还信息
export const getUnpaidInfoAPI = (params: { userId: number }) => {
  return http.get<Delivery.LogOutData>(`/manager/deliveryman/cancel/detail`, params, { loading: false });
};
// 注销账号
export const cancelAccountAPI = (data: { userId: number }) => {
  return http.post(`/manager/deliveryman/cancel`, data, { loading: false });
};
// 修改车辆押金或者使用费
export const updateDepositAPI = (data: Delivery.ExamineDepositParams) => {
  return http.post(`/manager/deliveryman/updateVehicleDepositOrUsageFee`, data, { loading: false });
};
// 移除关联车辆
export const removeRelateVehicleAPI = (data: { id: number }) => {
  return http.post(`/manager/deliveryman/unrelateVehicle`, data, { loading: false });
};
// 退还押金
export const depositRefundAPI = (data: { userId: number }) => {
  return http.post(`/manager/adeeilmnrvy/depositRefund`, data, { loading: false });
};
// 可选车辆列表
export const getAccCanListAPI = (data: AccCar.CanParams) => {
  return http.post<AccCar.CanData[]>(`/manager/vehicle/cityList`, data, { loading: false });
};
// 关联车辆
export const relateVehicleAPI = (data: { id: number; deliveryId: number }) => {
  return http.post(`/manager/deliveryman/relateVehicle`, data, { loading: false });
};
// 查询配送员借调驿站列表
export const getTransferStationListAPI = (params: { deliveryId: number }) => {
  return http.get<transfer.AlerayData[]>(`/manager/deliveryman/lendOutWarehouseList`, params, { loading: false });
};
// 查询可选择驿站列表
export const getCanTransferStationListAPI = (params: transfer.CanParams) => {
  return http.get<transfer.CanRow[]>(`/manager/warehouse/lists`, params, { loading: false });
};
// 选择借调驿站
export const selectTransferStationAPI = (data: { stationId: string; deliveryId: number }) => {
  return http.post(`/manager/deliveryman/lendOut`, data, { loading: false });
};
// 移除借调驿站
export const removeTransferStationAPI = (data: { userId: number; id: string }) => {
  return http.post(`/manager/deliveryman/unLendOut`, data, { loading: false });
};
// 修改手机号
export const updatePhoneAPI = (data: PhoneTime.PhoneParams) => {
  return http.post(`/manager/deliveryman/updatePhoneNo`, data, { loading: false });
};
// 修改上岗时间
export const updateOnDutyTimeAPI = (data: PhoneTime.TimeParams) => {
  return http.post(`/manager/deliverymanUpdate`, data, { loading: false });
};

// 站长模块
// 站长列表
export const getStationAdminListAPI = (params: StationAdmin.searchParams) => {
  return http.get<StationAdmin.NewRow[]>("/manager/stationMaster", params, { loading: false });
};
// 添加站长
export const addStationAdminAPI = (data: StationAdmin.AddParams) => {
  return http.post("/manager/stationMaster/add", data, { loading: false });
};
// 修改手机号
export const updateAdminPhoneAPI = (data: PhoneTime.PhoneParams) => {
  return http.post(`/manager/deliveryman/updatePhoneNo`, data, { loading: false });
};
// 修改上岗时间
export const updateAdminOnDutyTimeAPI = (data: PhoneTime.TimeParams) => {
  return http.put(`/manager/stationMaster`, data, { loading: false });
};
// 站长详情
export const getStationAdminDetailAPI = (userId: number) => {
  return http.get<StationAdmin.DetailData>(`/manager/stationMaster/${userId}`, { loading: false });
};
// 审核账号
export const examineAdminAPI = (data: StationAdmin.ExamineParams) => {
  return http.get(`/manager/stationMaster/audit`, data, { loading: false });
};
// 注销账号
export const cancelAdminAccountAPI = (data: { userId: number }) => {
  return http.post(`/manager/stationMaster/cancel`, data, { loading: false });
};
// 查询未体现金额
export const getUnpaidAmountAPI = (params: { userId: number }) => {
  return http.get<{ balance: string }>(`/manager/stationMaster/cancel/detail`, params);
};
